package houtaiDao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;

import HoutaiUtil.MybatisUtil;
import Model.LieBiao;

public class LieBiaoDaoimpl implements LibiaoDap {
	@Override
	public List<LieBiao> selectLie() {
		MybatisUtil mybat = new MybatisUtil();
		SqlSession session = mybat.mbtutil();
		List<LieBiao> list = session.selectList("houtaiDao.LibiaoDap.selectLie");
		session.close();	
		return list;
	}

	@Override
	public Integer lieid(String shopid) {
		MybatisUtil mybat = new MybatisUtil();
		SqlSession session = mybat.mbtutil();
		Integer shopids = session.selectOne("houtaiDao.LibiaoDap.lieid",shopid);
		session.close();
		return shopids;
	}

	@Override
	public int delShop(int shopid) {
		MybatisUtil mybat = new MybatisUtil();
		SqlSession session = mybat.mbtutil();
		int flag = session.delete("houtaiDao.LibiaoDap.delShop",shopid);
		session.commit();
		session.close();
		return flag;
	}

	@Override
	public int addLie(String shopname) {
		MybatisUtil mybat = new MybatisUtil();
		SqlSession session = mybat.mbtutil();
		int flag = session.insert("houtaiDao.LibiaoDap.addLie",shopname);
		session.commit();
		session.close();
		return flag;
	}

	@Override
	public int del(Map map) {
		MybatisUtil mybat = new MybatisUtil();
		SqlSession session = mybat.mbtutil();
		int flag = session.update("houtaiDao.LibiaoDap.del",map);
		session.commit();
		session.close();
		return flag;
	}

}
